package com.model.pool;

import com.face.ConstantDecorate;
import com.model.ClassInfo;
import com.model.structure.ConstantPool;
import com.util.Analysis;
import com.util.SystemNumber;
import lombok.Data;

/**
 * @author seven
 */
@Data
public class ConstantFloatInfo extends BaseConstantDecorate implements ConstantDecorate {
    private Float bytes;
    private Integer bytesLen=4;

    /**
     * 解析float常量
     * @param info
     */
    @Override public void invoke(ClassInfo info, Analysis analysis,int tag) {
        if(tag == SystemNumber.FOUR){
            this.setBytes(analysis.util.sixteenToFloat(analysis.readValue(this.getBytesLen())));
            this.setConstantPoolInfoType("CONSTANT_Float_info");
            this.setTag(tag);
            info.getPoolList().add(this);
        }else{
            new ConstantIntegerInfo().invoke(info,analysis,tag);
        }
    }
}
